package us.icitap.cm.business.entities;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import org.eclipse.persistence.annotations.Customizer;

import us.icitap.cm.business.entities.regmin.States;
import us.icitap.cm.utils.MyCustomizer;

@Entity
@Customizer(MyCustomizer.class)
@Table(name="POLICE_OPERATION", schema="MPC")
public class PoliceOperation extends BaseEntity implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 4542634552317770713L;
	
	@Id
	@Column(insertable=false, updatable = false)
	private Integer id;
	
	
	@OneToOne
	@JoinColumn(name="ID",nullable=false)
	private Report report;
	
	
	@JoinColumn(name="OPERATION_TYPE_ID")
	private AppList operationType;
	
	
	@ManyToMany
	@JoinTable(name="MPC.PO_STATES", joinColumns=@JoinColumn(name="PO_ID"), inverseJoinColumns=@JoinColumn(name="STATE_ID"))
	private List<States> statesList;
	
	
	
	public PoliceOperation() {
		// TODO Auto-generated constructor stub
	}
	
	public PoliceOperation(Report report) {
		this.report = report;
	}
	
	
	
	
	
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PoliceOperation other = (PoliceOperation) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	public AppList getOperationType() {
		return operationType;
	}
	public void setOperationType(AppList operationType) {
		this.operationType = operationType;
	}
	public Report getReport() {
		return report;
	}
	public void setReport(Report report) {
		this.report = report;
	}
	public List<States> getStatesList() {
		return statesList;
	}
	public void setStatesList(List<States> statesList) {
		this.statesList = statesList;
	}
}
